﻿using System;

namespace RoketSolutions.SP2010.Infrostructure.Common.Extensions
{
    public static class Strings
    {
        public static bool IsNullOrEmpty(this string value)
        {
            return string.IsNullOrEmpty(value);
        }

        public static bool EqualByContent(this string source, string compareTo)
        {
            var sourceValue = source.IsNullOrEmpty() ? string.Empty : source.Trim();
            var compareToValue = compareTo.IsNullOrEmpty() ? string.Empty : compareTo.Trim();
            return String.Compare(sourceValue, compareToValue, StringComparison.OrdinalIgnoreCase) == 0;
        }

        public static string TrimText(this string source)
        {
            return source.IsNullOrEmpty() ? string.Empty : source.Trim();
        }

    }
}